package com.ui.adapter;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;

import com.core.sdk.R;
import com.core.sdk.core.BaseFragment;
import com.core.sdk.ui.viewpager.JazzyViewPager;
import com.core.sdk.ui.viewpager.JazzyViewPagerAdapter;
import com.ui.fragment.MainFragment1;
import com.ui.fragment.MainFragment2;
import com.ui.fragment.MainFragment3;

public class MainTabPagerAdapter extends JazzyViewPagerAdapter {

	public MainTabPagerAdapter(FragmentManager fm,JazzyViewPager vp) {
		super(fm,vp);
	}
	

	@Override
	public int getItemPosition(Object object) {
		return POSITION_NONE;
	}


	@Override
	public int getPageImageResourceId(int position) {
		return 0;
	}

	@Override
	public int getPageBackgroupResourceId(int position) {
		int color = 0;
		switch (position) {
		case 0:
			color = R.color.red;
			break;
		case 1:
			color = R.color.green;
			break;
		case 2:
			color = R.color.blue;
			break;
		}
		return color;
	}

	@Override
	public Fragment getItem(int pos) {
		BaseFragment bf = null;
		switch (pos) {
		case 0:
			bf = new MainFragment1();
			break;
		case 1:
			bf = new MainFragment2();
			break;
		case 2:
			bf = new MainFragment3();
			break;
		}
		Bundle bd = new Bundle();
		bd.putString("data", "Fragment" + (pos + 1));
		bf.setArguments(bd);
		return bf;
	}

	@Override
	public int getCount() {
		return 3;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		String title = "";
		switch (position) {
		case 0:
			title = "Page1";
			break;
		case 1:
			title = "Page2";
			break;
		case 2:
			title = "Page3";
			break;
		}
		return title;
	}
}
